local FightBuff = require("gameLogic.fight.fightBuff.FightBuff")
local BuffFakeAttr = class("BuffFakeAttr", FightBuff)

function BuffFakeAttr:ctor(config, entity, whoEntity)
    BuffFakeAttr.super.ctor(self, config, entity, whoEntity)
end

function BuffFakeAttr:_excute(battleReport)
    local attack_attr = self._config.attack_attr
    local dtValue = self:_attrChange()
    local curAttrValue = self._entity:getFakeAttrValue(attack_attr)
    if self._config.toneup == 0 then
        curAttrValue = curAttrValue - dtValue
    else
        curAttrValue = curAttrValue + dtValue
    end
    self._attrValue = self._attrValue + dtValue
    self._entity:setFakeAttrValue(attack_attr, curAttrValue)
    self._manager:afectBuffReport(self, dtValue, battleReport)
end

function BuffFakeAttr:resetbuff()
    if not self._attrValue then
        return
    end
    local curValue = self._entity:getFakeAttrValue(self._config.attack_attr)
    if self._config.toneup == 0 then
        curValue = curValue + self._attrValue
        self._entity:setFakeAttrValue(self._config.attack_attr, curValue)
    else
        curValue = curValue - self._attrValue
        self._entity:setFakeAttrValue(self._config.attack_attr, curValue)
    end
end

return BuffFakeAttr
